
from win32com import client as wc
import docx

#n1为读取出来的原文件名,split分片得到后缀名,name2为得到的后缀名
name1 = n1.split(".")
houzm = name1[-1]
name2 = name1 + "docx"

#拼接文件路径和地址名
dress1 = r"D:\user\Downloads"
dress2 = r"D:\user\Downloads" + "n1"
#转换之后的文件名
name2 = r"D:\user\Downloads" + name2

def ZhuanHuanDoc(dress2, name2, bj):
    if houzm == "doc":
        word = wc.Dispatch("Word.Application")
        
        doc = word.Documents.Open(dress2)
        
        doc.SaveAs(name2, 12)
        
        doc.Close()
        
        word.Quit()

    if houzm == "docx":
    
    	def get_docx(file_name):
        d = docx.opendocx(file_name)
        doc = docx.getdocumenttext(d)
        return doc
    
    doc = get_docx('SHIVS-OMS-DMS-V2.1-新特性列表.doc')
    print(doc)  # 输出行数：1075
    for d in doc[:5]:
        if "刘嘉伟" in d:
    	    print("ok")
			

with open(r'C:\Users\01383317\lsh.txt', 'r') as f:
    nr = f.readlines()

cis = 0
l = []
while 1:
    for i in range(len(nr)):
	    i = (nr.pop())[4:]
		l.append(i)
        cis += 1
	if cis == len(nr):
	    break
	



if __name__ == "__main__":

#
